﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommerceOne.Domains.Entities;
using CommerceOne.Domains.Repositories;

namespace CommerceOne.Domains.SqlRepositories
{
    public class SqlBrandRepository : IBrandRepository
    {
        private readonly EfDbContext _sqlContext = new EfDbContext();

        /// <summary>
        /// Gets all.
        /// </summary>
        /// <returns></returns>
        public List<Brand> GetAll()
        {
            return this._sqlContext.Brands.ToList();
        }

        /// <summary>
        /// Gets the by id.
        /// </summary>
        /// <param name="brandId">The brand id.</param>
        /// <returns></returns>
        public Brand GetById(int brandId)
        {
            return this._sqlContext.Brands.Where(p=>p.Id == brandId).FirstOrDefault();
        }
    }
}
